<template>
    <div>
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/toOneList' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>借贷管理</el-breadcrumb-item>
        <el-breadcrumb-item>新标维护</el-breadcrumb-item>
      </el-breadcrumb>
      <el-card>
        <el-input style="width: 200px" v-model="obj.borrowerId" placeholder="借款人id"></el-input>
        <el-button type="primary" @click="sel01()">查询</el-button>
        <el-table
          :data="tableData"
          border
          style="width: 100%">
          <el-table-column
            type="index"
            align="center"
            label="序号">
          </el-table-column>
          <el-table-column
            prop="bidName"
            align="center"
            label="标名">
          </el-table-column>
          <el-table-column
            prop="borrowerId"
            align="center"
            label="借款人ID">
          </el-table-column>
          <el-table-column
            prop="riskLev"
            align="center"
            label="风险等级">
            <template slot-scope="scope">
              {{scope.row.riskLev|rkfit}}
            </template>
          </el-table-column>
          <el-table-column
            prop="totalAmount"
            align="center"
            label="借款总金额">
          </el-table-column>
          <el-table-column
            prop="interest"
            label="年利率(%)"
            align="center"
            width="80px">
          </el-table-column>
          <el-table-column
            prop="repayType"
            align="center"
            label="还款方式">
            <template slot-scope="scope">
              {{scope.row.repayType|rtfit}}
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="trem"
            label="借款期限"
            width="70px">
          </el-table-column>
          <el-table-column
            align="center"
            prop="termType"
            label="期限类型"
            width="70px">
            <template slot-scope="scope">
              {{scope.row.termType == 0?"天":"月"}}
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="manageRate"
            label="管理费月率(%)"
            width="100px">
          </el-table-column>
          <el-table-column
            align="center"
            prop="fineRate"
            label="超期不还罚款的利息(%)"
            width="100px"
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="loanType"
            label="借款类型"
            width="80px">
            <template slot-scope="scope">
              {{scope.row.loanType|ltfit}}
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="useFund"
            label="资金用途">
          </el-table-column>
          <el-table-column
            align="center"
            prop="repaySouce"
            label="还款来源">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status"
            label="状态">
            <template slot-scope="scope">
              {{scope.row.status|stafit}}
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="createTime"
            label="创建时间">
            <template slot-scope="scope">
              {{scope.row.createTime | datefmt('YYYY-MM-DD HH:mm:ss')}}
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="updateTime"
            label="修改时间">
            <template slot-scope="scope">
              {{scope.row.updateTime | datefmt('YYYY-MM-DD HH:mm:ss')}}
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="approver"
            label="审核人id">
          </el-table-column>
          <el-table-column
            align="center"
            label="操作"
          width="120px">
            <template slot-scope="scope">
              <el-dropdown size="mini" split-button type="primary" trigger="click">
                操作
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item @click.native="update(scope.row.id,1)">修改</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </template>
          </el-table-column>

        </el-table>
        <el-pagination
          align="center"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="page.pagenum"
          :page-sizes="[5, 10, 15, 20]"
          :page-size="page.pagesize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </el-card>
    </div>
</template>

<script>
    export default {
        name: "Maintain",
      data(){
        return{
          obj:{},
          tableData:[],//借款信息集合
          total:0,
          page:{
            pagenum:0,
            pagesize:5
          }
        }
      },
      methods:{
        toaddbiao:function(id){
          this.$router.push("/addbiao?id="+id);
        },
        update:function(id){ //审核状态修改
          this.$router.push({path:"/updateloan",query:{id:id}})
        },
        handleSizeChange:function (val) {
          this.page.pagesize=val;
          this.sel01();
        },
        handleCurrentChange:function (val) {
          this.page.pagenum=val;
          this.sel01();
        },
        sel01:function () {//查询借款信息集合
          this.$http.post("/finance-service-borrowing/loan/newlist/"+this.page.pagenum+"/"+this.page.pagesize,this.obj).then(
            (res)=>{
              this.tableData=res.data.result.list;
              this.total=res.data.result.total;
            }
          )
        }

      },
      filters:{
        rkfit:function(val){
          if(val==0){
            return '极低'
          }
          if(val==1){
            return '较低'
          }
          if(val==2){
            return '中等'
          }
          if(val==3){
            return '中高'
          }
          if(val==4){
            return '高'
          }
        },
        rtfit:function (val) {
          if(val==0){
            return '一次性还款'
          }
          if(val==1){
            return '等额本金'
          }
          if(val==2){
            return '等额本息'
          }
        },
        ltfit:function (val) {
          if(val==0){
            return '新增'
          }
          if(val==1){
            return '续贷'
          }
          if(val==2){
            return '资产处理'
          }
        },
        stafit:function (val) {
          if(val==0){
            return '草稿'
          }
          if(val==1){
            return '新标待审核'
          }
        }
      },
      mounted () {
        this.sel01();

      }
    }
</script>

<style scoped>

</style>
